Haskell Rules: Embedding Rule Systems in Haskell
نویسندگان
چکیده
We present a domain-specific embedded language that allows the definition of rule systems in Haskell. As one particular example, we consider the modeling of type systems, which is an important part of programming language design. Type systems are most conveniently described using rule systems. Our approach is well integrated into Haskell’s type system and thus facilitates the convenient modeling of type systems and language semantics in general. We also demonstrate how our DSEL allows functional-logic programming in Haskell. Our system generalizes previous work by operating on user-defined data types, taking advantage of static typing, representing rules as functions, and allows a creative integration of logical variables into data structures which generalizes two previous approaches. We describe a straightforward method for translating rule systems into our DSEL.
منابع مشابه
A Framework for Implementing Type Systems
Type systems are ubiquitous in the study of programming languages. Although the basic mechanisms are well understood, a new type system can still be a challenge to implement. We present the design and implementation of a domain-specific language (i.e., a functional framework) for writing type system implementations. This domain-specific language has been embedded in both Haskell and Scheme. It ...
متن کاملAutomated soundness checking of a programming logic for Haskell
P-logic is a verification logic for the programming language Haskell. Inference rules are expressed in sequent calculus for each of the term constructs of Haskell. Validating soundness of these rules is an essential task. Most rules of P-logic are polymorphic, independent of Haskell’s type classes. The paper develops a parametricity principle for predicates of P-logic, which justifies checking ...
متن کاملA Haskell Implementation of a Rule-Based Program Transformation for C Programs
Obtaining good performance when programming heterogeneous computing platforms poses significant challenges for the programmer. We present a program transformation environment, implemented in Haskell, where architectureagnostic scientific C code is transformed into a functionally equivalent one better suited for a given platform. The transformation rules are formalized in a domainspecific langua...
متن کاملHaskell Programming with Nested Types: A Principled Approach
Initial algebra semantics is one of the cornerstones of the theory of modern functional programming languages. For each inductive data type, it provides a Church encoding for that type, a build combinator which constructs data of that type, a fold combinator which encapsulates structured recursion over data of that type, and a fold/build rule which optimises modular programs by eliminating from...
متن کاملHaskell Programming with Nested Types : A Principled
Initial algebra semantics is one of the cornerstones of the theory of modern functional programming languages. For each inductive data type, it provides a Church encoding for that type, a build combinator which constructs data of that type, a fold combinator which encapsulates structured recursion over data of that type, and a fold/build rule which optimises modular programs by eliminating from...
متن کامل